// Ninf-G-XX, ver. 0.1
// Copyright 2011 National Institute of Advanced Industrial Science and Technology
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "Ninf.h"


#ifndef FALSE
#define FALSE (1 == 0)
#endif

#ifndef TRUE
#define TRUE (0 == 0)
#endif

#define N    3


double A [N * N]  = {0, 1, 2, 3, 4, 5, 6, 7, 8};
double B [N * N]  = {1, 0, 0, 0, 1, 0, 0, 0, 1};
double C [N * N]  = {0, 0, 0, 0, 0, 0, 0, 0, 0};

extern int ninf_error_code;
int verbose = FALSE;

int matmul_test(){
  if (NinfCall("matmul/matmul", N, A, B, C) != NINF_NO_ERROR) {
    NinfPerror("filename_test: ");
    return FALSE;
  }    
  for (int i = 0; i < N * N; i++)
    printf("%f ", *(C+i));
  
  return TRUE;
}


int main(int argc, char ** argv)
{
  argc = NinfParseArg(argc, argv);

  while (argc > 1){
    argv++;
    if (strcasecmp(*(argv), "-verbose") == 0)
      verbose = TRUE;
    //      if (strcasecmp(*(argv), "-debug") == 0)
    //	ninf_debug_flag = TRUE;
    argc--;
  }

  if (matmul_test())  {printf("\tOK\n");} else { printf("\tfailed\n");}

  NinfFinalize();
  return 1;
}

